project(x3manager)

include_directories(${CMAKE_SOURCE_DIR}/interface)
include_directories(${CMAKE_SOURCE_DIR}/interface/x3manager)
include_directories(${CMAKE_SOURCE_DIR}/src/x3manager)

SET(PROJECT_INTERFACE ${CMAKE_SOURCE_DIR}/interface/x3manager)
SET(PROJECT_SRC ${CMAKE_SOURCE_DIR}/src/x3manager)

set(INTERFACE_H_CPP
	${PROJECT_INTERFACE}/objptr.h
	${PROJECT_INTERFACE}/iobject.h
)

SOURCE_GROUP(Interface FILES ${INTERFACE_H_CPP})

set(MODULE_H_CPP
	${PROJECT_INTERFACE}/module/classentry.h
	${PROJECT_INTERFACE}/module/classmacro.h
	${PROJECT_INTERFACE}/module/moduleitem.h
	${PROJECT_INTERFACE}/module/modulemacro.h
	${PROJECT_INTERFACE}/module/normalobject.h
	${PROJECT_INTERFACE}/module/pluginimpl.h
	${PROJECT_INTERFACE}/module/plugininc.h
	${PROJECT_INTERFACE}/module/singletonobj.h
)

SOURCE_GROUP(Interface\\module FILES ${MODULE_H_CPP})

set(NONPLUGIN_H_CPP
	${PROJECT_INTERFACE}/nonplugin/scanplugins.h
	${PROJECT_INTERFACE}/nonplugin/swigext.h
	${PROJECT_INTERFACE}/nonplugin/useplugin.h
	${PROJECT_INTERFACE}/nonplugin/useplugins.h
)

SOURCE_GROUP(Interface\\nonplugin FILES ${NONPLUGIN_H_CPP})

set(OBSERVER_H_CPP
	${PROJECT_INTERFACE}/observer/eventobserver.h
	${PROJECT_INTERFACE}/observer/fireevent.h
	${PROJECT_INTERFACE}/observer/fireobjevent.h
	${PROJECT_INTERFACE}/observer/observerimpl.h
	${PROJECT_INTERFACE}/observer/observerobject.h
)

SOURCE_GROUP(Interface\\observer FILES ${OBSERVER_H_CPP})

set(PORTABILITY_H_CPP
	${PROJECT_INTERFACE}/portability/func_s.h
	${PROJECT_INTERFACE}/portability/pathstr.h
	${PROJECT_INTERFACE}/portability/portimpl.h
	${PROJECT_INTERFACE}/portability/uniximpl.h
	${PROJECT_INTERFACE}/portability/winimpl.h
	${PROJECT_INTERFACE}/portability/x3port.h
	${PROJECT_INTERFACE}/portability/x3unix.h
	${PROJECT_INTERFACE}/portability/x3win.h
)

SOURCE_GROUP(Interface\\portability FILES ${PORTABILITY_H_CPP})

set(MANAGER_H_CPP
	${PROJECT_INTERFACE}/manager/iplugins.h
	${PROJECT_INTERFACE}/manager/iworkpath.h
	${PROJECT_INTERFACE}/manager/x3manager.h
)

SOURCE_GROUP(Interface\\manager FILES ${MANAGER_H_CPP})

set(UTILFUNC_H_CPP
	${PROJECT_INTERFACE}/utilfunc/convstr.h
	${PROJECT_INTERFACE}/utilfunc/loadmodule.h
	${PROJECT_INTERFACE}/utilfunc/lockcount.h
	${PROJECT_INTERFACE}/utilfunc/lockrw.h
	${PROJECT_INTERFACE}/utilfunc/readints.h
	${PROJECT_INTERFACE}/utilfunc/roundstr.h
	${PROJECT_INTERFACE}/utilfunc/safecall.h
	${PROJECT_INTERFACE}/utilfunc/scanfiles.h
	${PROJECT_INTERFACE}/utilfunc/syserrstr.h
	${PROJECT_INTERFACE}/utilfunc/vecfunc.h
)

SOURCE_GROUP(Interface\\utilfunc FILES ${UTILFUNC_H_CPP})

set(SRC_H_CPP
	${PROJECT_SRC}/workpath.h
	${PROJECT_SRC}/workpath.cpp
	${PROJECT_SRC}/plugins.h
	${PROJECT_SRC}/plugins.cpp
	${PROJECT_SRC}/module.cpp
)

SOURCE_GROUP(Source FILES ${SRC_H_CPP})

add_library(
	${PROJECT_NAME} SHARED 
	${SRC_H_CPP}
	${INTERFACE_H_CPP}
	${MODULE_H_CPP}
	${NONPLUGIN_H_CPP}
	${PORTABILITY_H_CPP}
	${MANAGER_H_CPP}
	${OBSERVER_H_CPP}
	${UTILFUNC_H_CPP}
	)	

ADD_DEFINITIONS(-D_USRDLL)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "x3manager" SUFFIX  ".pln")

#INSTALL(TARGETS ${OUT_NAME} DESTINATION lib)
#INSTALL(TARGETS ${OUT_NAME} DESTINATION bin)
